﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.Practices.Prism.Mvvm;
using System.ComponentModel;

namespace Infrastucture
{
    public abstract class ViewModel : BindableBase
    {
        // todo use as base for view model, inherit bindable base,
        // don't think i need the erros for this one


    }

    public class EditableList<T> : ObservableCollection<DomainObject>
    {
        public event Infrastucture.DomainObject.ItemEndEditEventHandler ItemEndEdit;


        protected override void InsertItem(int index, DomainObject item)
        {
            base.InsertItem(index, item);
            item.ItemEndEdit += new DomainObject.ItemEndEditEventHandler(ItemEndEditHandler);
        }

        private void ItemEndEditHandler(IEditableObject sender)
        {
            if (ItemEndEdit != null)
                ItemEndEdit(sender);
        }
    }
}
